package com.travel.recommend.controller;

import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.travel.recommend.entity.SimilarityConfigEntity;
import com.travel.recommend.service.SimilarityConfigService;
import com.travel.common.utils.PageUtils;
import com.travel.common.utils.R;



/**
 * 
 *
 * @author lxw
 * @email lxw@gmail.com
 * @date 2024-01-23 09:52:06
 */
@RestController
@RequestMapping("recommend/similarityconfig")
public class SimilarityConfigController {
    @Autowired
    private SimilarityConfigService similarityConfigService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("recommend:similarityconfig:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = similarityConfigService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{similarityConfigId}")
    //@RequiresPermissions("recommend:similarityconfig:info")
    public R info(@PathVariable("similarityConfigId") Integer similarityConfigId){
		SimilarityConfigEntity similarityConfig = similarityConfigService.getById(similarityConfigId);

        return R.ok().put("similarityConfig", similarityConfig);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("recommend:similarityconfig:save")
    public R save(@RequestBody SimilarityConfigEntity similarityConfig){
		similarityConfigService.save(similarityConfig);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("recommend:similarityconfig:update")
    public R update(@RequestBody SimilarityConfigEntity similarityConfig){
		similarityConfigService.updateById(similarityConfig);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("recommend:similarityconfig:delete")
    public R delete(@RequestBody Integer[] similarityConfigIds){
		similarityConfigService.removeByIds(Arrays.asList(similarityConfigIds));

        return R.ok();
    }

}
